const data={
    names:'zzl',
    lis:[
        'wxl',
        'll',
        'hhl'
    ],
    [Symbol.iterator](){
        let index=0;
        let _this = this;
        return{
            next:function(){
                if(index<_this.lis.length){
                    const result = {value:_this.lis[index],done:false};
                    index++;
                    return result;
                }else{
                    return {value:undefined,done:true};
                }
            }
        }
    }
}


for(let v of data){
    console.log(v);
    
}

console.log(data);
console.log('----------------');


var arr = ['blue','green','red'];
let it = iterator(arr);
console.log(it.next());
console.log(it.next());
console.log(it.next());



function iterator(arr){
    let nextIndex = 0;
    return {
        next:function(){
            return nextIndex<arr.length?{
                value:arr[nextIndex++],done:true
            }:{
                value:undefined,done:false
            }
        }
    }
}


function test(a,b){
    console.log(arguments);
   let a1 =  Array.prototype.slice.call(arguments);
    let a2 = Array.from(arguments);
    console.log(a1);
    console.log(a2);
    
}

test(5,8);